﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <Windows.h>
#include <qtcpsocket>
#include <QTcpServer>
#include <QModbusTcpServer>
#include <masterthread/cmodbusclient.h>

#pragma comment(lib, "user32.lib")
QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_pushButton_clicked();

    void slot_connect();

    void slot_start();

    void on_pushButton_2_clicked();

    void slot_readyRead();

private:
    Ui::MainWindow *ui;
    QTcpServer *m_tcpserver;
    QTcpSocket *m_tcpsocket;

    QTcpServer *m_tcpserverBase;
    QTcpSocket *m_tcpsocketBase;

    CModbusClient m_modbusClient;

    void sendKeyPress(WORD keyCode);

    void sendKeyRelease(WORD keyCode);

    float x,x2;

    float y,y2;

    int lenth;

    int width;

    int tag = 0;

};
#endif // MAINWINDOW_H
